package com.example.demo.service.Impl;

import com.example.demo.entity.Admin;
import com.example.demo.mapper.AdminMapper;
import com.example.demo.service.AdminService;

import java.util.ArrayList;
import java.util.List;


public class AdminServiceImpl implements AdminService {
    AdminMapper adminmapper=new AdminMapper();

    @Override
    public List<Admin> AdminRegister(String admin, String admin_psw) {
        Admin admin1=new Admin();
        admin1.setAdmin(admin);
        admin1.setAdmin_psw(admin_psw);
        List<Admin> list=new ArrayList();
        try{
            list=adminmapper.AdminRegister(admin1);
        }catch (Exception e){
            e.printStackTrace();
        }

        return list;
    }

    @Override
    public boolean AdminUpdate_pws(String admin, String admin_psw, String newadmin_psw) {
        try{
            adminmapper.AdminUpdate_pws(admin, admin_psw, newadmin_psw);
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public boolean Admindelete(String admin, String admin_psw) {
        try{
            adminmapper.Admindelete(admin, admin_psw);
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public boolean Admindeletadd(String admin, String admin_psw) {
        try{
            adminmapper.Admindeletadd(admin, admin_psw);
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
        return true;
    }


}
